<?php
namespace App\Http\Controllers\Admin;

use App\Http\Controllers\BaseAdminController;
use App\Lib\Logger;
use App\Service\LogService;
use Illuminate\Http\Request;

class LogController extends BaseAdminController{
    public function index(Request $request){
        $search = $request->input();
        $logService = new LogService();
        $list = $logService->getLogList(isset($search['limit'])?$search['limit']:15,$search);
        $level = Logger::getLogLevel();
        $module = Logger::getLogModuleDict();
        $config = [];
        if(!empty($search['module'])){
            $config = Logger::getModule($search['module']);
        }
        return view("admin.log.index",compact(["list","level","module","config"]));
    }
    public function getModuleConfig(Request $request){
        $data = $request->input();
        $res = Logger::getModule($data['value']);
        return $res;
    }
}
